from sqlalchemy import Column, Integer, String, DateTime, ForeignKey
from datetime import datetime

from sqlalchemy.dialects.mysql import LONGTEXT

from auth.db import Base

class ECGRecord(Base):
    __tablename__ = "ecg_records"

    id = Column(Integer, primary_key=True, index=True)
    device_id = Column(String(64), index=True)     # ✅ 指定长度
    owner = Column(String(64), index=True)         # ✅ 指定长度
    start_time = Column(DateTime, default=datetime.utcnow)
    end_time = Column(DateTime, nullable=True)
    data = Column(LONGTEXT)                            # ✅ ECG数据使用Text
    timestamps = Column(LONGTEXT, nullable=True)

